<template>
<view>  
		 <view >  
<view  style="position:fixed;z-index:9;top:0 ;width:100%;	background-color: #efeff4;">
		<form @submit="formSubmit" @reset="formReset">
	<view class="uni-form-item uni-column">		
	<input   class="uni-input" name="nickname" v-model="nickname"  placeholder="请输入昵称" />

	</view>
	          <view class="button-sp-area">
                <!-- <button class="mini-btn" type="primary"  form-type="submit" size="mini">生成</button> -->
                <button class="mini-btn" type="default" form-type="reset" size="mini">清空</button>
            </view>
	</form>
</view>	
  <view  class="htd"></view>
<text class="example-info">在文本框中输入昵称，然后点击下面喜欢的样式，然后到需要修改昵称的地方粘贴即可。</text>
<view class="example-body" >
  
			<view class="tag-view"   v-for="(value, index) in nick" :key="index" data-text="{{value.name}}" @tap="setType">
				<uni-tag text="{{value.name}}"/></view>
	
		</view>
	<!-- #ifdef MP-QQ -->
    <view class="adContainer">
	<ad  unit-id="49fbbff61639d5c62ace1745f1f019b0" type="feeds"></ad>
    </view>
    <!-- #endif  -->

	<!-- #ifdef MP-WEIXIN  -->
      <view class="adContainer">
       <ad  unit-id="adunit-8ef9c266b9ad1ab8"  bindload="adLoad" binderror="adError" bindclose="adClose"></ad>
     </view>
    <!-- #endif  -->  </view>
	
		     </view>
</template>
<script>
export default {
	data() {
		return {
			nick:[],
			nickname:'昵称',
			cacename:''
		}
        },
		methods: {
			setType(e) {

				if(this.nickname==""){
				this.nickname=e.currentTarget.dataset.text;
				}else{
					if(this.cacename==''){
						this.cacename=this.nickname;
					}
					if(this.cacename==""&&this.nickname==""){
						this.cacename="昵称";
					}
					this.nickname=e.currentTarget.dataset.text.replace("昵称",this.cacename);
				}

	uni.setClipboardData({
    data:this.nickname,
    success: function () {
        console.log('success');
    }
});
			}
			,formSubmit(e){
              console.log(e);
			},	formReset: function(e) {
				this.cacename='';
				this.nickname='';
				
				console.log('清空数据')
			}
		},	
			/**
   * 用户点击右上角分享
   */
//   onShareAppMessage: function () {
//     qq.showShareMenu({
//   showShareItems: ['qq', 'qzone', 'wechatFriends', 'wechatMoment']
// })
//   },
		    	onLoad(e){
					var _this=this;
					uni.showToast({
					title: "加载中...",
					icon: "loading",
			
				})
						uni.request({
					url: _this.URLs+ "/nice.json",
					success: resp => {
							uni.hideToast()
					
						_this.nick=resp.data;
							console.log(_this.nick);
					
					
					},
					fail: (data, code) => {
							uni.hideToast()
						console.log('fail' + JSON.stringify(data));
					}
				});
			

         
    
  }
        }
</script>
<style>

	.uni-form-item .title {
		padding: 20rpx 0;
	}
	.htd{
		height: 100px;
	}
	.tag-view{
		width:49%;
	}
        button {
        margin-top: 30rpx;
        margin-bottom: 30rpx;
    }

    .button-sp-area {
		text-align: center;
        margin: 0 auto;
        width:100%;
    }

    .mini-btn {
        margin-right: 10rpx;
    }
	/* #ifndef APP-NVUE */
	page {
		display: flex;
		flex-direction: column;
		box-sizing: border-box;
		background-color: #efeff4;
		min-height: 100%;
		height: auto;
			font-size: 12px;
	}

	view {
		font-size: 12px;
		line-height: inherit;
	}

	.example {
		padding: 0 15px 15px;
	}

	.example-info {
		padding: 15px;
		color: #3b4144;
		background: #ffffff;
	}

	.example-body {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
		flex-wrap: wrap;
		justify-content: center;
		padding: 0;
		font-size: 14px;
	
		background-color: #ffffff;
	}

	/* #endif */
	.example {
		padding: 0 15px;
	}

	.example-info {
		/* #ifndef APP-NVUE */
		display: block;
		/* #endif */
		padding: 15px;
		color: #3b4144;
		background-color: #ffffff;
		font-size: 14px;
		line-height: 20px;
	}

	.example-info-text {
		font-size: 14px;
		line-height: 20px;
		color: #3b4144;
	}



	.word-btn-white {
		font-size: 18px;
		color: #FFFFFF;
	}

	.word-btn {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
		align-items: center;
		justify-content: center;
		border-radius: 6px;
		height: 48px;
		margin: 15px;
		background-color: #007AFF;
	}

	.word-btn--hover {
		background-color: #4ca2ff;
	}


	.example-body {
		/* #ifndef APP-PLUS-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
		justify-content: flex-start;
		flex-wrap: wrap;
		padding: 20rpx;
	}

	.tag-view {
		/* #ifndef APP-PLUS-NVUE */
		display: flex;
		/* #endif */
		flex-direction: column;
		margin: 1rpx;
		justify-content: center;
	}
</style>